VS2008: Simple DataGridView not populating
am 01.04.2008 21:56:36 von cshThis is a multipart message in MIME format.
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Co ntext:
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Wi ndows
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Po stgreSQL
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>ps ql-obdc
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Vi sual
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Pr oblem:
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>I
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>In
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Cr eate
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Do
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>An alysis:
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>En abling
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>If
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>[E RROR]
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>So
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>I
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>
style=3D'font-size:12.0pt;font-family:"Garamond","serif"'>Ch arles
style=3D'font-family:"Garamond","serif"'>Henkel
style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>99 17
style=3D'font-size:10.0pt;font-family:"Garamond","serif"'>La s
------=_NextPart_000_0034_01C893F7.D28F7000
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Context:
Windows Vista x64
PostgreSQL 8.3 (server on localhost)
psql-obdc v8.03.01
Visual Studio 2008 (VS2008)
Problem:
I created a System DSN using the Data Sources (ODBC) administration tool
located in
one you get from Control Panel ->Administrative Tools (that one is in
successful.
In VS2008, add new Data Source picking up one table from the DSN just
created. On Data Sources tab, can rightclick the table and "Preview
Data"...works fine in the IDE, successfully retrieving data from the
database.
Create a trivial Windows Forms Application with a DataGridView [DGV]
control. No code-behind...just connect the DGV Data Source to the DSN table.
Run the application...no data in DGV.
Do exact same thing except with Northwind DSN (sample SQL Server database,
not using PostgreSQL or psql-odbc)...run app...DGV populates just fine.
Analysis:
Enabling mylog in psql-odbc doesn't give much information. If I log the
VS2008 IDE interaction with the DSN (e.g., when using "Preview Data")...it
all looks good.
If I compile the app and execute it with mylog enabled...nothing in the log
file except the intialization from turning on logging. That is, the app
never finds the DSN, and in fact gives an error to that effect:
[ERROR] [IM002] [Microsoft] [ODBC Driver Manager] Data source name not found
and no default driver specified.
So it appears that this may be an x64 issue...The application can't find the
DSN probably because there is no entry for it in
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI...instead the entry is in the
redirected key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI but
it's not getting redirected there.
I can't understand why the VS2008 IDE can interact with the DSN just fine,
but the simple app can't find it. Perhaps there's a "target platform" I have
to specify? Any ideas?
Charles S. Henkel
Henkel Technical Computing, LLC
9917 Laurel Springs Ave
Las Vegas, NV 89134
------=_NextPart_000_0034_01C893F7.D28F7000
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
charset=3Dus-ascii">
o:p>
Vista x64
8.3 (server on localhost)
v8.03.01
Studio 2008 (VS2008)
o:p>
created a System DSN using the Data Sources (ODBC) administration tool =
located
in <system>\SysWOW64\odbcad32.exe. Note that this is *not* =
the
same one you get from Control Panel ->Administrative Tools (that one =
is in
<system>/system32 and can apparently only manage 64 bit DSNs). =
Test
successful.
VS2008, add new Data Source picking up one table from the DSN just =
created. On
Data Sources tab, can rightclick the table and "Preview =
Data"...works
fine in the IDE, successfully retrieving data from the =
database.
a trivial Windows Forms Application with a DataGridView [DGV] control. =
No
code-behind...just connect the DGV Data Source to the DSN table. Run the
application...no data in DGV.
exact same thing except with Northwind DSN (sample SQL Server database, =
not
using PostgreSQL or psql-odbc)...run app...DGV populates just =
fine.
/o:p>
mylog in psql-odbc doesn't give much information. If I log the VS2008 =
IDE
interaction with the DSN (e.g., when using "Preview =
Data")...it all
looks good.
I compile the app and execute it with mylog enabled...nothing in the log =
file
except the intialization from turning on logging. That is, the app never =
finds
the DSN, and in fact gives an error to that =
effect:
[IM002] [Microsoft] [ODBC Driver Manager] Data source name not found and =
no
default driver specified.
it appears that this may be an x64 issue...The application can't find =
the DSN
probably because there is no entry for it in =
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI...instead
the entry is in the redirected key =
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI
but it's not getting redirected there.
can't understand why the VS2008 IDE can interact with the DSN just fine, =
but
the simple app can't find it. Perhaps there's a "target =
platform" I
have to specify? Any ideas?
S. Henkel
Technical Computing, LLC
Laurel Springs Ave
Vegas, NV 89134
------=_NextPart_000_0034_01C893F7.D28F7000--